test: TDD hardening + fuzz coverage for table conversion (#6)#8
Merged
Conversation
Follow-up hardening for the table list/header conversion, developed test-first (each test below was confirmed failing before the fix): - Drop empty <li> items so they don't leave a stray "•"/"N." with no text. - Strip any pre-existing intra-cell sentinel from the input so source content can never inject a spurious <br> line break. - Promote a table's first row into <thead> only when it is a genuine, all-<th> header row (a row mixing <th> and <td> is left in the body). Adds unit + end-to-end regression tests and brings flattenCellLists, cleanListItemText, and promoteTableHeaderRows to 100% statement coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Aqueeb Qadri <aqueeb@gmail.com>
Add FuzzPreProcessHTML seeds for lists inside table cells, header-row promotion, mixed th/td rows, malformed/unclosed lists, empty items, and sentinel-like text; add FuzzPostProcessMarkdown seeds exercising the intra-cell line-break sentinel. Active fuzzing (45s each) surfaced no crashers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Aqueeb Qadri <aqueeb@gmail.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #7 that hardens the table list/header-row conversion using a test-first (TDD) loop, plus active fuzzing. No behavior change for well-formed Confluence exports; this closes real edge-case gaps and locks them with tests.
Test-first process (red → green)
Three tests were written first and confirmed failing against the merged code, then fixed:
<li></li>items•/N.bullets with no text<br><th>+<td><thead><th>Regression locks (green)
Inline formatting/links inside list items (
• **bold**,• [link](url)), separate<ol>lists restart numbering, multiple tables each promoted, and header-only tables convert without falling back to raw HTML.Fuzzing
FuzzPreProcessHTMLseeds: lists in cells, nested/malformed lists, header rows in<tbody>, mixedth/td, many empty<li>, sentinel-like text.FuzzPostProcessMarkdownseeds exercising the intra-cell sentinel.Coverage
flattenCellLists,cleanListItemText,promoteTableHeaderRows— 100% statement coverage.Verification
go test ./... -racegreen ·go vet ./...clean ·gofmtclean onmarkdown.go/markdown_test.go.Notes
preProcessHTMLonly ever runs once per document.converter/fuzz_test.go(andmime_test.go,main_test.go) carry pre-existing CRLF line endings thatgofmtflags under Go 1.25; CI (Go 1.21 golangci-lint) does not gate on this. Happy to send a separate line-ending-normalization PR if wanted.🤖 Generated with Claude Code